<!--新增会员-->
<template>
  <section class="webview fixHeight">
    <el-scrollbar style="height:100%">
      <!--      商铺出租-->
      <el-form v-if="$route.query.type == 1" ref="form" :model="detail" label-width="100px" class="form">
        <el-form-item label="商铺类型">
          <el-select v-model="detail.mainResidentialId" multiple placeholder="一级分类">
            <el-option
              v-for="item in mainResidentialIdOptions"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            />
          </el-select>
        </el-form-item>
		<el-form-item label="商铺性质">
		  <el-select v-model="detail.mainResidentialId" multiple placeholder="一级分类">
		    <el-option
		      v-for="item in mainResidentialIdOptions"
		      :key="item.id"
		      :label="item.name"
		      :value="item.id"
		    />
		  </el-select>
		</el-form-item>
		<el-form-item label="经营状态">
		 <span>经营中</span>
		</el-form-item>
		<el-form-item label="楼层">
		  <span>单层</span>第<span>3</span>层 共<span>10</span>层
		</el-form-item>
		<el-form-item label="建筑面积">
		  <el-input v-model="detail.aboutUs" />
		</el-form-item>
		<el-form-item label="面宽">
		  <el-input v-model="detail.aboutUs" />
		</el-form-item>
		<el-form-item label="层高">
		  <el-input v-model="detail.aboutUs" />
		</el-form-item>
		<el-form-item label="进深">
		  <el-input v-model="detail.aboutUs" />
		</el-form-item>
		<el-form-item label="商铺配套">
		  <span style="margin-right: 12px;">空调</span>
		  <span style="margin-right: 12px;">空调</span>
		  <span style="margin-right: 12px;">空调</span>
		</el-form-item>
		<el-form-item label="商铺标签">
		  <span style="margin-right: 12px;">空调</span>
		  <span style="margin-right: 12px;">空调</span>
		  <span style="margin-right: 12px;">空调</span>
		</el-form-item>
		<el-form-item label="是否临街">
		  <span style="margin-right: 12px;">是</span>
		</el-form-item>
		<el-form-item label="区域板块">
		  <el-select v-model="detail.mainResidentialId" multiple placeholder="区域">
		    <el-option
		      v-for="item in mainResidentialIdOptions"
		      :key="item.id"
		      :label="item.name"
		      :value="item.id"
		    />
		  </el-select>
		  <el-select style='margin-top: 12px;' v-model="detail.mainResidentialId" multiple placeholder="板块">
		    <el-option
		      v-for="item in mainResidentialIdOptions"
		      :key="item.id"
		      :label="item.name"
		      :value="item.id"
		    />
		  </el-select>
		</el-form-item>
		<el-form-item label="商铺名称">
		  <el-input v-model="detail.aboutUs" />
		</el-form-item>
		<el-form-item label="商铺地址">
		  <el-input v-model="detail.aboutUs" />
		</el-form-item>
		<el-form-item label="房源标签">
		  <span style="margin-right: 12px;">空调</span>
		  <span style="margin-right: 12px;">空调</span>
		  <span style="margin-right: 12px;">空调</span>
		</el-form-item>
		
		
		<!-- <div style="margin-bottom: 20px;border-bottom: 1px solid #ddd;padding-bottom: 12px;">价格信息</div> -->
		<el-form-item label="租金">
		  <el-input v-model="detail.aboutUs" />
		</el-form-item>
		<el-form-item label="起租期">
		  <el-input v-model="detail.aboutUs" />
		</el-form-item>
		<el-form-item label="免租期">
		  <el-input v-model="detail.aboutUs" />
		</el-form-item>
		<el-form-item label="支付方式">
		  <el-input v-model="detail.aboutUs" />
		</el-form-item>
		<el-form-item label="相关费用">
		  <span style="margin-right: 12px;">空调</span>
		  <span style="margin-right: 12px;">空调</span>
		  <span style="margin-right: 12px;">空调</span>
		</el-form-item>
		<el-form-item label="标题">
		  <el-input v-model="detail.aboutUs" />
		</el-form-item>
		<el-form-item label="详细介绍">
		  <el-input  type="textarea" :rows="4" placeholder="请输入..." v-model="detail.account" />
		</el-form-item>
		<el-form-item label="全景图">
		  <el-input v-model="detail.aboutUs" />
		</el-form-item>
		<el-form-item label="视频">
		  <div class="picList">
		    <div v-for="(item,index) in fileListHead" class="item">
		      <img class="pic" :src="item" alt>
		    </div>
		  </div>
		</el-form-item>
		<el-form-item label="房源图">
		  <div class="picList">
		    <div v-for="(item,index) in fileListHead" class="item">
		      <img class="pic" :src="item" alt>
		    </div>
		  </div>
		</el-form-item>
		
        
        
       
        
        <el-form-item>
          <el-button  @click="ok(scope.row.id)">通过</el-button>
          <el-button  @click="back(scope.row.id)">打回</el-button>
          <el-button @click="cancel">返回</el-button>
        </el-form-item>
      </el-form>
     <!-- 商铺出售 -->
	 <el-form v-if="$route.query.type == 2" ref="form" :model="detail" label-width="100px" class="form">
	   <el-form-item label="商铺类型">
	     <el-select v-model="detail.mainResidentialId" multiple placeholder="一级分类">
	       <el-option
	         v-for="item in mainResidentialIdOptions"
	         :key="item.id"
	         :label="item.name"
	         :value="item.id"
	       />
	     </el-select>
	   </el-form-item>
	 		<el-form-item label="商铺性质">
	 		  <el-select v-model="detail.mainResidentialId" multiple placeholder="一级分类">
	 		    <el-option
	 		      v-for="item in mainResidentialIdOptions"
	 		      :key="item.id"
	 		      :label="item.name"
	 		      :value="item.id"
	 		    />
	 		  </el-select>
	 		</el-form-item>
	 		<el-form-item label="经营状态">
	 		 <span>经营中</span>
	 		</el-form-item>
	 		<el-form-item label="楼层">
	 		  <span>单层</span>第<span>3</span>层 共<span>10</span>层
	 		</el-form-item>
	 		<el-form-item label="建筑面积">
	 		  <el-input v-model="detail.aboutUs" />
	 		</el-form-item>
	 		<el-form-item label="面宽">
	 		  <el-input v-model="detail.aboutUs" />
	 		</el-form-item>
	 		<el-form-item label="层高">
	 		  <el-input v-model="detail.aboutUs" />
	 		</el-form-item>
	 		<el-form-item label="进深">
	 		  <el-input v-model="detail.aboutUs" />
	 		</el-form-item>
	 		<el-form-item label="商铺配套">
	 		  <span style="margin-right: 12px;">空调</span>
	 		  <span style="margin-right: 12px;">空调</span>
	 		  <span style="margin-right: 12px;">空调</span>
	 		</el-form-item>
	 		<el-form-item label="商铺标签">
	 		  <span style="margin-right: 12px;">空调</span>
	 		  <span style="margin-right: 12px;">空调</span>
	 		  <span style="margin-right: 12px;">空调</span>
	 		</el-form-item>
	 		<el-form-item label="是否临街">
	 		  <span style="margin-right: 12px;">是</span>
	 		</el-form-item>
	 		<el-form-item label="区域板块">
	 		  <el-select v-model="detail.mainResidentialId" multiple placeholder="区域">
	 		    <el-option
	 		      v-for="item in mainResidentialIdOptions"
	 		      :key="item.id"
	 		      :label="item.name"
	 		      :value="item.id"
	 		    />
	 		  </el-select>
	 		  <el-select style='margin-top: 12px;' v-model="detail.mainResidentialId" multiple placeholder="板块">
	 		    <el-option
	 		      v-for="item in mainResidentialIdOptions"
	 		      :key="item.id"
	 		      :label="item.name"
	 		      :value="item.id"
	 		    />
	 		  </el-select>
	 		</el-form-item>
	 		<el-form-item label="商铺名称">
	 		  <el-input v-model="detail.aboutUs" />
	 		</el-form-item>
	 		<el-form-item label="商铺地址">
	 		  <el-input v-model="detail.aboutUs" />
	 		</el-form-item>
	 		<el-form-item label="房源标签">
	 		  <span style="margin-right: 12px;">空调</span>
	 		  <span style="margin-right: 12px;">空调</span>
	 		  <span style="margin-right: 12px;">空调</span>
	 		</el-form-item>
	 		
	 		
	 		<!-- <div style="margin-bottom: 20px;border-bottom: 1px solid #ddd;padding-bottom: 12px;">价格信息</div> -->
	 		<el-form-item label="售价">
	 		  <el-input v-model="detail.aboutUs" />
	 		</el-form-item>
	 		<el-form-item label="相关费用">
	 		  <span style="margin-right: 12px;">空调</span>
	 		  <span style="margin-right: 12px;">空调</span>
	 		  <span style="margin-right: 12px;">空调</span>
			   <el-input v-model="detail.aboutUs" />
	 		</el-form-item>
	 		<el-form-item label="标题">
	 		  <el-input v-model="detail.aboutUs" />
	 		</el-form-item>
	 		<el-form-item label="详细介绍">
	 		  <el-input  type="textarea" :rows="4" placeholder="请输入..." v-model="detail.account" />
	 		</el-form-item>
	 		<el-form-item label="全景图">
	 		  <el-input v-model="detail.aboutUs" />
	 		</el-form-item>
	 		<el-form-item label="视频">
	 		  <div class="picList">
	 		    <div v-for="(item,index) in fileListHead" class="item">
	 		      <img class="pic" :src="item" alt>
	 		    </div>
	 		  </div>
	 		</el-form-item>
	 		<el-form-item label="房源图">
	 		  <div class="picList">
	 		    <div v-for="(item,index) in fileListHead" class="item">
	 		      <img class="pic" :src="item" alt>
	 		    </div>
	 		  </div>
	 		</el-form-item>
	 		
	   
	   
	  
	   
	   <el-form-item>
	     <el-button  @click="ok(scope.row.id)">通过</el-button>
	     <el-button  @click="back(scope.row.id)">打回</el-button>
	     <el-button @click="cancel">返回</el-button>
	   </el-form-item>
	 </el-form>
      <!--      写字楼出租-->
      <el-form v-if="$route.query.type == 3" ref="form" :model="detail" label-width="100px" class="form">
        <el-form-item label="写字楼类型">
          <el-select v-model="detail.mainResidentialId" multiple placeholder="请选择">
            <el-option
              v-for="item in mainResidentialIdOptions"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            />
          </el-select>
        </el-form-item>
      		<el-form-item label="写字楼性质">
      		  <el-select v-model="detail.mainResidentialId" multiple placeholder="一级分类">
      		    <el-option
      		      v-for="item in mainResidentialIdOptions"
      		      :key="item.id"
      		      :label="item.name"
      		      :value="item.id"
      		    />
      		  </el-select>
      		</el-form-item>
			<el-form-item label="可注册公司">
			 <span>是</span>
			</el-form-item>
			<el-form-item label="区域板块">
			  <el-select v-model="detail.mainResidentialId" multiple placeholder="区域">
			    <el-option
			      v-for="item in mainResidentialIdOptions"
			      :key="item.id"
			      :label="item.name"
			      :value="item.id"
			    />
			  </el-select>
			  <el-select style='margin-top: 12px;' v-model="detail.mainResidentialId" multiple placeholder="板块">
			    <el-option
			      v-for="item in mainResidentialIdOptions"
			      :key="item.id"
			      :label="item.name"
			      :value="item.id"
			    />
			  </el-select>
			</el-form-item>
			<el-form-item label="写字楼名称">
			  <el-input v-model="detail.aboutUs" />
			</el-form-item>
			<el-form-item label="写字楼地址">
			  <el-input v-model="detail.aboutUs" />
			</el-form-item>
      		<el-form-item label="所在楼层">
      		  <span>单层</span>第<span>3</span>层 共<span>10</span>层
      		</el-form-item>
      		<el-form-item label="建筑面积">
      		  <el-input v-model="detail.aboutUs" />
      		</el-form-item>
      		<el-form-item label="得房率">
      		  <el-input v-model="detail.aboutUs" />
      		</el-form-item>
      		<el-form-item label="装修情况">
      		  <el-input v-model="detail.aboutUs" />
      		</el-form-item>
			<el-form-item label="可分割">
			 <span>是</span>
			</el-form-item>
      		<el-form-item label="写字楼配套">
      		  <span style="margin-right: 12px;">空调</span>
      		  <span style="margin-right: 12px;">空调</span>
      		  <span style="margin-right: 12px;">空调</span>
      		</el-form-item>
      		<el-form-item label="写字楼标签">
      		  <span style="margin-right: 12px;">空调</span>
      		  <span style="margin-right: 12px;">空调</span>
      		  <span style="margin-right: 12px;">空调</span>
      		</el-form-item>
      		
      		
      		<!-- <div style="margin-bottom: 20px;border-bottom: 1px solid #ddd;padding-bottom: 12px;">价格信息</div> -->
      		<el-form-item label="租金">
      		  <el-input v-model="detail.aboutUs" />
      		</el-form-item>
      		<el-form-item label="相关费用">
      		  <span style="margin-right: 12px;">空调</span>
      		  <span style="margin-right: 12px;">空调</span>
      		  <span style="margin-right: 12px;">空调</span>
      		</el-form-item>
			<el-form-item label="起租期">
			  <el-input v-model="detail.aboutUs" />
			</el-form-item>
			<el-form-item label="免租期">
			  <el-input v-model="detail.aboutUs" />
			</el-form-item>
			<el-form-item label="支付方式">
			  <el-input v-model="detail.aboutUs" />
			</el-form-item>
			<el-form-item label="相关费用">
			  <span style="margin-right: 12px;">空调</span>
			  <span style="margin-right: 12px;">空调</span>
			  <span style="margin-right: 12px;">空调</span>
			</el-form-item>
      		<el-form-item label="标题">
      		  <el-input v-model="detail.aboutUs" />
      		</el-form-item>
      		<el-form-item label="详细介绍">
      		  <el-input  type="textarea" :rows="4" placeholder="请输入..." v-model="detail.account" />
      		</el-form-item>
      		<el-form-item label="全景图">
      		  <el-input v-model="detail.aboutUs" />
      		</el-form-item>
      		<el-form-item label="视频">
      		  <div class="picList">
      		    <div v-for="(item,index) in fileListHead" class="item">
      		      <img class="pic" :src="item" alt>
      		    </div>
      		  </div>
      		</el-form-item>
      		<el-form-item label="房源图">
      		  <div class="picList">
      		    <div v-for="(item,index) in fileListHead" class="item">
      		      <img class="pic" :src="item" alt>
      		    </div>
      		  </div>
      		</el-form-item>
      		
        
        
       
        
        <el-form-item>
          <el-button  @click="ok(scope.row.id)">通过</el-button>
          <el-button  @click="back(scope.row.id)">打回</el-button>
          <el-button @click="cancel">返回</el-button>
        </el-form-item>
      </el-form>
      <!--      写字楼出售-->
      <el-form v-if="$route.query.type == 4" ref="form" :model="detail" label-width="100px" class="form">
		  <el-form-item label="写字楼类型">
		    <el-select v-model="detail.mainResidentialId" multiple placeholder="请选择">
		      <el-option
		        v-for="item in mainResidentialIdOptions"
		        :key="item.id"
		        :label="item.name"
		        :value="item.id"
		      />
		    </el-select>
		  </el-form-item>
		  	<el-form-item label="写字楼性质">
		  	  <el-select v-model="detail.mainResidentialId" multiple placeholder="一级分类">
		  	    <el-option
		  	      v-for="item in mainResidentialIdOptions"
		  	      :key="item.id"
		  	      :label="item.name"
		  	      :value="item.id"
		  	    />
		  	  </el-select>
		  	</el-form-item>
		  	<el-form-item label="可注册公司">
		  	 <span>是</span>
		  	</el-form-item>
		  	<el-form-item label="区域板块">
		  	  <el-select v-model="detail.mainResidentialId" multiple placeholder="区域">
		  	    <el-option
		  	      v-for="item in mainResidentialIdOptions"
		  	      :key="item.id"
		  	      :label="item.name"
		  	      :value="item.id"
		  	    />
		  	  </el-select>
		  	  <el-select style='margin-top: 12px;' v-model="detail.mainResidentialId" multiple placeholder="板块">
		  	    <el-option
		  	      v-for="item in mainResidentialIdOptions"
		  	      :key="item.id"
		  	      :label="item.name"
		  	      :value="item.id"
		  	    />
		  	  </el-select>
		  	</el-form-item>
		  	<el-form-item label="写字楼名称">
		  	  <el-input v-model="detail.aboutUs" />
		  	</el-form-item>
		  	<el-form-item label="写字楼地址">
		  	  <el-input v-model="detail.aboutUs" />
		  	</el-form-item>
		  	<el-form-item label="所在楼层">
		  	  <span>单层</span>第<span>3</span>层 共<span>10</span>层
		  	</el-form-item>
		  	<el-form-item label="建筑面积">
		  	  <el-input v-model="detail.aboutUs" />
		  	</el-form-item>
		  	<el-form-item label="得房率">
		  	  <el-input v-model="detail.aboutUs" />
		  	</el-form-item>
		  	<el-form-item label="装修情况">
		  	  <el-input v-model="detail.aboutUs" />
		  	</el-form-item>
		  	<el-form-item label="可分割">
		  	 <span>是</span>
		  	</el-form-item>
		  	<el-form-item label="写字楼配套">
		  	  <span style="margin-right: 12px;">空调</span>
		  	  <span style="margin-right: 12px;">空调</span>
		  	  <span style="margin-right: 12px;">空调</span>
		  	</el-form-item>
		  	<el-form-item label="写字楼标签">
		  	  <span style="margin-right: 12px;">空调</span>
		  	  <span style="margin-right: 12px;">空调</span>
		  	  <span style="margin-right: 12px;">空调</span>
		  	</el-form-item>
		  	
		  	
		  	<!-- <div style="margin-bottom: 20px;border-bottom: 1px solid #ddd;padding-bottom: 12px;">价格信息</div> -->
		  	<el-form-item label="售价">
		  	  <el-input v-model="detail.aboutUs" />
		  	</el-form-item>
		  	<el-form-item label="相关费用">
		  	  <span style="margin-right: 12px;">空调</span>
		  	</el-form-item>
		  	<el-form-item label="标题">
		  	  <el-input v-model="detail.aboutUs" />
		  	</el-form-item>
		  	<el-form-item label="详细介绍">
		  	  <el-input  type="textarea" :rows="4" placeholder="请输入..." v-model="detail.account" />
		  	</el-form-item>
		  	<el-form-item label="全景图">
		  	  <el-input v-model="detail.aboutUs" />
		  	</el-form-item>
		  	<el-form-item label="视频">
		  	  <div class="picList">
		  	    <div v-for="(item,index) in fileListHead" class="item">
		  	      <img class="pic" :src="item" alt>
		  	    </div>
		  	  </div>
		  	</el-form-item>
		  	<el-form-item label="房源图">
		  	  <div class="picList">
		  	    <div v-for="(item,index) in fileListHead" class="item">
		  	      <img class="pic" :src="item" alt>
		  	    </div>
		  	  </div>
		  	</el-form-item>
		  	
		  
		  
		         
		  
		  <el-form-item>
		    <el-button  @click="ok(scope.row.id)">通过</el-button>
		    <el-button  @click="back(scope.row.id)">打回</el-button>
		    <el-button @click="cancel">返回</el-button>
		  </el-form-item>
      </el-form>
    </el-scrollbar>
  </section>
</template>
<script>
import { residentialList, houareaList, shopList, memberUpdate, memberAdd, memberDetail, developersAdd, developersDetail, developersUpdate, agentAdd, agentDetail, agentUpdate, housePropertytAdd, housePropertyDetail, housePropertyUpdate } from '@/api/api'
export default {
  data() {
    return {
      fileListHead: [],
      fileListVideo: [],
      fileListLogo: [],
      fileListGsfc: [],
      fileListYyzz: [],
      fileListIntroduce: [],
      storeIdList: [],
      mainResidentialIdOptions: [],
      detail: {}
    }
  },
  created() {
    // 门店列表
    shopList({
      curPage: 1,
      pageSize: 9999,
      name: ''
    }).then(({ data }) => {
      this.storeIdList = data.records
    })
    // 小区列表 需要改一下
    residentialList({
      curPage: 1,
      pageSize: 6666,
      name: ''
    }).then(data => {
      this.mainResidentialIdOptions = data.data.records
    })
    if (this.$route.query.id) {
      // 房产公司
      if (this.$route.query.type == 3) {
        housePropertyDetail(this.$route.query.id).then(({ data }) => {
          this.detail = data
          if (this.detail.logo) {
            this.fileListLogo = [this.detail.logo]
          }
          this.detail.enterpriseResources.forEach((item, index) => {
            if (item.type == 0) {
              this.fileListGsfc.push(item.pictureUrl)
            }

            if (item.type == 1) {
              this.fileListYyzz.push(item.pictureUrl)
            }

            if (item.type == 2) {
              this.fileListIntroduce.push(item.pictureUrl)
            }
          })
        })
      }
      // 经纪人
      if (this.$route.query.type == 1) {
        agentDetail(this.$route.query.id).then(({ data }) => {
          this.detail = data
          if (this.detail.headPortrait) {
            this.fileListHead = [this.detail.headPortrait]
          }
        })
      }
      // 开发商
      if (this.$route.query.type == 2) {
        this.detail = JSON.parse(this.$route.query.id)
        this.fileListLogo = [this.detail.logo]
      }
      // 会员
      if (this.$route.query.type == 4) {
        memberDetail(this.$route.query.id).then(({ data }) => {
          this.detail = data
          if (this.detail.headPortrait) {
            this.fileListHead = [this.detail.headPortrait]
          }
        })
      }
    } else {
      if (this.$route.query.type == 1) {
        this.detail = {
          'aboutUs': '',
          'account': '',
          'email': '',
          'entryTime': '',
          'headPortrait': '',
          'id': '',
          'introduceUrl': '',
          'mainResidentialId': [
          ],
          'name': '',
          'phone': '',
          'storeId': '',
          'workYear': ''
        }
      }
      if (this.$route.query.type == 2) {
        this.detail = {
          'enterpriseType': '',
          'logo': '',
          'name': ''
        }
      }
      if (this.$route.query.type == 3) {
        this.detail = {
          'account': '',
          'briefIntroduction': '',
          'enterpriseResources': [
          ],
          'legalName': '',
          'logo': '',
          'mainBusiness': '',
          'name': '',
          'registeredPlace': ''
        }
      }
      if (this.$route.query.type == 4) {
        this.detail = {
          'account': '',
          'email': '',
          'headPortrait': '',
          'nickName': '',
          'phone': ''
        }
      }
    }
  },
  methods: {
    handleRemove(index) {
      this.fileList.splice(index, 1)
    },
    // 上传图片之前的验证
    handleUpload() {
    },
    // 上传成功之后的回调
    handleSuccess(res) {
      if (res.code === 200) {
        this.fileList.push(res.data)
        this.detail.imgLink = this.fileList[0]
      }
    },
    // 添加/编辑
    submit() {
      // 验证不通过则不提交
      // if (!this.vertify()) {
      //   return false
      // }
      if (this.$route.query.type == 1) {
        if (this.$route.query.id) {
          // 编辑
          agentUpdate(this.detail).then(data => {
            Is.tip('编辑成功', 2000, 'success')
            this.$router.back()
          })
        } else {
          // 新增
          agentAdd(this.detail).then(data => {
            Is.tip('添加成功', 2000, 'success')
            this.$router.back()
          })
        }
      }
      if (this.$route.query.type == 2) {
        if (this.$route.query.id) {
          // 编辑
          developersUpdate(this.detail).then(data => {
            Is.tip('编辑成功', 2000, 'success')
            this.$router.back()
          })
        } else {
          // 新增
          developersAdd(this.detail).then(data => {
            Is.tip('添加成功', 2000, 'success')
            this.$router.back()
          })
        }
      }
      if (this.$route.query.type == 3) {
        this.detail.enterpriseResources = []
        this.fileListGsfc.forEach(item => {
          this.detail.enterpriseResources.push({
            dataType: 0,
            pictureUrl: item,
            type: 0
          })
        })
        this.fileListYyzz.forEach(item => {
          this.detail.enterpriseResources.push({
            dataType: 0,
            pictureUrl: item,
            type: 1
          })
        })
        this.fileListIntroduce.forEach(item => {
          this.detail.enterpriseResources.push({
            dataType: 0,
            pictureUrl: item,
            type: 2
          })
        })
        if (this.$route.query.id) {
          // 编辑
          housePropertyUpdate(this.detail).then(data => {
            Is.tip('编辑成功', 2000, 'success')
            this.$router.back()
          })
        } else {
          // 新增
          housePropertytAdd(this.detail).then(data => {
            Is.tip('添加成功', 2000, 'success')
            this.$router.back()
          })
        }
      }
      if (this.$route.query.type == 4) {
        if (this.$route.query.id) {
          // 编辑
          memberUpdate(this.detail).then(data => {
            Is.tip('编辑成功', 2000, 'success')
            this.$router.back()
          })
        } else {
          // 新增
          memberAdd(this.detail).then(data => {
            Is.tip('添加成功', 2000, 'success')
            this.$router.back()
          })
        }
      }
    },
    // 返回
    cancel() {
      this.$router.back()
    },
    vertify() {
      if (Is.empty(this.detail.title)) {
        Is.tip('请输入标题')
        return false
      }
      if (Is.empty(this.detail.link)) {
        Is.tip('请输入链接')
        return false
      }
      if (Is.empty(this.detail.showType)) {
        Is.tip('请输入显示位置')
        return false
      }
      if (Is.empty(this.detail.sort)) {
        Is.tip('请输入排序')
        return false
      }
      if (Is.empty(this.fileList)) {
        Is.tip('请上传图片')
        return false
      }
      return true
    }
  }}
</script>
